package cn.hx.controller.front.user;

import cn.hx.entity.UserInfo;
import cn.hx.service.UserInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
public class UserInfoController {
    @Resource
    private UserInfoService userInfoService;

    @GetMapping("user/myHomePage")
    public String homePage(ModelMap map, HttpServletRequest request) {
        UserInfo userInfo = (UserInfo) request.getSession().getAttribute("userInfo");
        Integer id = userInfo.getId();
        System.out.println(userInfo.getId());
        map.put("user", userInfoService.queryById(id));
        return "user/myHomePage";
    }

}
